import request from "@/utils/request";

// export function fetchList(query) {
//   return request({
//     url: '/vue-element-admin/article/list',
//     method: 'get',
//     params: query
//   })
// }
export function fetchList(boj) {
  return request({
    url: '/user/getUserList',
    method: 'get',
    zzmflag: true, 
    params: { 'token': boj.token, pageSize: boj.page, pageIndex: boj.pageInedx }
  })
}
export function getCompanyAll(boj) {
  console.log(boj)
  return request({
    url: '/user/getCompanyAll',
    method: 'get',
    zzmflag: true,
    params: { token: boj.token, pageSize: boj.page, pageIndex: boj.pageInedx },
  });
}
export function fetchList1(obj) {
  return request({
    url: "/user/getWork",
    method: "get",
    zzmflag: true,
    params: { 'token': obj.token, pageSize: obj.page, pageIndex: obj.pageInedx }
  })
}

// 删除用户
export function deletList(boj) {
  return request({
    url: "/user/delUser",
    method: "get",
    zzmflag: true,
    params: boj,
  });
}

// delWork

export function delWork(boj) {
  return request({
    url: '/user/delWork',
    method: 'get',
    zzmflag: true,
    params: boj
  })
}

// 获取班级列表
export function getClassList(boj) {
  return request({
    url: "/user/getClassName",
    method: "get",
    zzmflag: true,
    params: boj,
  });
}

// 修改用户信息
export function editUserList(data) {
  const datas = {
    password: data.password,
    email: data.email,
    mobile: data.mobile,
    username: data.username,
    id: data.region,
  };
  return request({
    url: "/user/editUser",
    method: "post",
    zzmflag: true,
    data: datas,
  });
}

// 多条添加
export function insertAllWorkApi(datas) {
  console.log(datas);
  return request({
    url: "/user/insertAllWork",
    method: "put",
    zzmflag: true,
    data: datas,
  });
}

// 添加班级
export function AddClassApi(datas) {
  return request({
    url: "/user/addClass",
    method: "post",
    zzmflag: true,
    data: datas,
  });
}
// 删除班级
export function DelClassApi(params) {
  return request({
    url: "/user/delClass",
    method: "get",
    zzmflag: true,
    params: params,
  });
}
// 修改班级
export function EditClassApi(params) {
  return request({
    url: "/user/editClass",
    method: "post",
    zzmflag: true,
    data: params,
  });
}

export function fetchArticle(id) {
  return request({
    url: "/vue-element-admin/article/detail",
    method: "get",
    params: { id },
  });
}

export function fetchPv(pv) {
  return request({
    url: "/vue-element-admin/article/pv",
    method: "get",
    params: { pv },
  });
}

export function createArticle(data) {
  const datas = {
    password: data.password,
    email: data.email,
    mobile: data.mobile,
    username: data.username,
    cid: data.region,
  };
  return request({
    url: "/user/register",
    method: "post",
    zzmflag: true,
    data: datas,
  });
}

export function addWorkOne(data) {
  const datas = {
    name: data.name,
    worktime: data.worktime,
    company: data.company,
    city: data.city,
    address: data.address,
    tel: data.tel,
    teacherx: data.teacherx,
    teacherj: data.teacherj,
    money: data.money,
    classname: data.classname,
    sex: data.sex,
    home: data.home,
    worksheng: data.worksheng,
    homesheng: data.homesheng,
  };
  return request({
    url: "/user/addWorkOne",
    method: "post",
    zzmflag: true,
    data: datas,
  });
}

export function updateArticle(data) {
  return request({
    url: "/vue-element-admin/article/update",
    method: "post",
    data,
  });
}
